#! /usr/bin/env python
import rospy
import actionlib
from point.msg import *


class MyActionServer:
    def __init__(self):
        #SimpleActionServer(name, ActionSpec, execute_cb=None, auto_start=True)
        self.server = actionlib.SimpleActionServer("addInts",PointCalculaterAction,self.cb,False)
        self.server.start()
        rospy.loginfo("服务端启动")


    def cb(self,goal):
        rospy.loginfo("服务端处理请求:")
        #1.解析目标值
        num = goal.u
        num = goal.v

        result = PointCalculaterResult()
        result.x = 1.0
        result.y = 2.0
        result.z = 3.0
        self.server.set_succeeded(result)
        rospy.loginfo("响应")
        
if __name__ == "__main__":
    rospy.init_node("action_server_p")
    server = MyActionServer()
    rospy.spin()
